#include <iostream>
#include <set>
#include <stdio.h>
#include <iterator>
using namespace std;
string str[]={"num[0]","num[1]","num[2]","num[3]","+","-","*","/"};
bool getnum(const char* &p, int& r)
{
    const char* lp = p;
    r = 0;
    while( *lp >= '0' && *lp <= '9' ) {
        r *= 10;
        r += *lp - '0';
        ++lp;
    }
    if (p == lp)
        return false;

    p = lp;
    return true;
}

bool getop1(const char* &p, char& r)
{
    if ( *p == '+' || *p == '-' ) {
        r = *p;
        ++p;
        return true;
    } else
        return false;
}

bool getop2(const char* &p, char& r)
{
    if ( *p == '*' || *p == '/' ) {
        r = *p;
        ++p;
        return true;
    } else
        return false;
}

bool getfactor(const char* &p, int& r)
{
    const char* lp = p;
    r = 1;
    if ( getnum(lp, r) ) {
        char op;
        while ( getop2(lp, op) ) {
            int a;
            if ( getnum(lp, a) ) {
                if ( op == '*' ) {
                    r *= a;
                } else if ( op == '/' ) {
                    r /= a;
                }
            } else {
                return false;
            }
        }
        p = lp;
        return true;
    } else
        return false;
}

bool getexpr(const char* &p, int& r)
{
    const char* lp = p;
    r = 0;
    if ( getfactor(lp, r) ) {
        char op;
        while ( getop1(lp, op) ) {
            int a;
            if ( getfactor(lp, a) ) {
                if ( op == '+' ) {
                    r += a;
                } else if ( op == '-' ) {
                    r -= a;
                }
            } else {
                return false;
            }
        }
        p = lp;
        return true;
    } else
        return false;
}


class solution
{
public:
	int calculate(string s)
	{
		double result = 0, inter_res = 0, num = 0;
		char op = '+';
		char ch;
                //找到第一个不为空的字符
		for (int pos = s.find_first_not_of(' '); pos < s.size(); pos = s.find_first_not_of(' ', pos))
		{
			ch = s[pos];
                        //判断是否是数字
			if (ch >= '0' && ch <= '9')
			{
				int num = ch - '0';
                                //判断下一个字符是否也是数字
				while (++pos < s.size() && s[pos] >= '0' && s[pos] <= '9')
					num = num * 10 + s[pos] - '0';
				switch (op)
				{
				case '+':
					inter_res += num;
					break;
				case'-':
					inter_res -= num;
					break;
				case'*':
					inter_res *= num;
					break;
				case'/':
					inter_res /= num;
					break;
				}
			}
			else
			{
				if (ch == '+' || ch == '-')
				{
					result += inter_res;
					inter_res = 0;
				}
				op = s[pos++];
			}
		}
		return result + inter_res;
	}
};

int main() {
    freopen("mid.in","w",stdout);
    set<string> v;
    string s="";
    solution so;
	for(int i=1;i<14;i++)
	{
	    for(int j=1;j<14;j++)
	    {if(i==j)continue;
	        for(int k=1;k<14;k++)
	        {if(i==k||k==j)continue;
	            for(int l=1;l<14;l++)
	            {if(i==l||l==j||l==k)continue;
	            	for(int m=4;m<8;m++)
					{
						for(int n=4;n<8;n++)
						{
						    for(int o=4;o<8;o++)
						    {
								//s=s+(char)(i+'0')+str[m]+(j+'0')+str[n]+(k+'0')+str[o]+(l+'0');
                                char aaaa,bbbb;
                                s="";s[5]=',';
                                if(i>=10)
                                {aaaa=(i/10)+'0';bbbb=(i%10)+'0';s+=aaaa;s+=bbbb;}
                                else 
                                {aaaa=i+'0';s+='0';s+=aaaa;}
                                s+=str[m];
                                if(j>=10)
                                {aaaa=(j/10)+'0';bbbb=(j%10)+'0';s+=aaaa;s+=bbbb;}
                                else 
                                {aaaa=j+'0';s+='0';s+=aaaa;}
                                s+=str[n];
                                if(k>=10)
                                {aaaa=(k/10)+'0';bbbb=(k%10)+'0';s+=aaaa;s+=bbbb;}
                                else 
                                {aaaa=k+'0';s+='0';s+=aaaa;}
                                s+=str[o];
                                if(l>=10)
                                {aaaa=(l/10)+'0';bbbb=(l%10)+'0';s+=aaaa;s+=bbbb;}
                                else 
                                {aaaa=l+'0';s+='0';s+=aaaa;}
                                /*if(so.calculate(s)==24.0)*/
                                int r;
                                const char *p=&s[0];
                                if ( getexpr(p, r) ) {
                                    int c = p - s.c_str();
                                    /*while( c --> 0 )
                                        putchar('^');
                                    putchar('\n');
                                    printf("%d\n", r);*/
                                    if(r==24)
                                    {
                                        s[2]=',';
                                        s[5]=',';s[8]=',';
                                        s='y'+s;
                                        //cout<<s<<endl;
	                			        v.insert(s);
                                    }
                                }
						    }
						}
					}
	            }
	        }
	    }
	}
/*	for(int i=0;i<v.size();i++)
	{
	    cout<<v[i]<<endl;
	}*/
    set<string>::iterator it;
    for(it=v.begin();it!=v.end();it++)
    {
        cout<<*it<<endl;
    }
	cout<<v.size()<<endl;
	return 0;
}
